﻿var ConfirmDialog = {
    ConfirmFunc: function () {

    }
};

function MyMsgBox(id, title, msg, type) {
    this.boxId = id;
    this.boxTitle = title;
    this.boxMsg = msg;
    this.boxUI = "<div id='" + this.boxId + "' title='" + this.boxTitle + "'>"
                + "<center><div class='confirm_msg'>" + this.boxMsg + "</div></center></div>";
    this.boxType = type;
}

MyMsgBox.prototype.Init = function () {
    $(this.boxUI).appendTo("body")

    var box_height = 200;
    var box_width = 250;

    switch (this.boxType) {
        case "small":
            box_height = 200;
            box_width = 250;
            break;
        case "medium":
            box_height = 300;
            box_width = 400;
            break;
        case "large":
            box_height = 600;
            box_width = 800;
            break;
        default:
            box_height = 200;
            box_width = 250;
    }

    $("#" + this.boxId).dialog({
        autoOpen: false,
        height: box_height,
        width: box_width,
        modal: true,
        buttons: {
            "是": function () {
                ConfirmDialog.ConfirmFunc();

                $(this).dialog("close");
            },
            "否": function () {
                $(this).dialog("close");
            }
        }
    });
}

MyMsgBox.prototype.Show = function () {
    $("#" + this.boxId).dialog("open");
}

